<?php
/**
 * Created by PhpStorm.
 * User: alexey
 * Date: 5/18/14
 * Time: 4:42 PM
 */

namespace controller;


abstract class ActionFinder
{

  public static $actionMap;

  abstract function init();

  function getAction($from)
  {
    if (!isset(self::$actionMap)) {
      $this->init();
    }

    self::$actionMap->rewind();
    $count = self::$actionMap->count();
    for ($i = 0; $i < $count; $i++) {
      if (self::$actionMap->current()->getFrom() == trim($from)) {
        return self::$actionMap->current()->getAction();
      }
      self::$actionMap->next();
    }
  }
} 